Avoid usage of deprecated datetime.datetime.utcfromtimestamp in pendulum.from_timestamp#803
Closed
Taragolis wants to merge 1 commit intopython-pendulum:masterfrom
Closed
Conversation
…ndulum.from_timestamp`
CodSpeed Performance ReportMerging #803 will not alter performanceComparing Summary
|
iakat
added a commit
to iakat/ircstates
that referenced
this pull request
Mar 13, 2024
Related: python-pendulum/pendulum#696 Unit tests showing deprecation warnings, see python-pendulum/pendulum#803
2 tasks
SinTh0r4s
reviewed
Sep 2, 2024
| dt = datetime( | ||
| dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond | ||
| ) | ||
| dt = DateTime.fromtimestamp(timestamp, tz=UTC) |
There was a problem hiding this comment.
I think the current suggestion is recursive and does not use the correct keyword:
Suggested change
| dt = DateTime.fromtimestamp(timestamp, tz=UTC) | |
| dt = _datetime.datetime.fromtimestamp(timestamp, tzinfo=UTC) |
For the develop branch, the change must be done in pendulum/pendulum.py:491
dt = datetime.datetime.utcfromtimestamp(timestamp).replace(tzinfo=UTC)to
dt = datetime.datetime.fromtimestamp(timestamp, tzinfo=UTC)
2 tasks
iakat
added a commit
to iakat/ircstates
that referenced
this pull request
Sep 15, 2024
Related: python-pendulum/pendulum#696 Unit tests showing deprecation warnings, see python-pendulum/pendulum#803
|
Also interested in this fix; is there help needed to get this through? (I see a failing test, but unsure if that's accurate as this is pretty old.) |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
datetime.datetime.utcfromtimestamp()is deprecated into the Python 3.12 as result current implementation raise warning message/usr/local/lib/python3.12/site-packages/pendulum/__init__.py:295 DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: